home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / gengetopt-2.6.lha / gengetopt-2.6 / doc / Makefile.am < prev    next >
Makefile  |  2001-12-16  |  4KB  |  131 lines

  1. # Copyright (C) 1999, 2000, 2001  Free Software Foundation, Inc.
  2. #  
  3. # This file is part of GNU gengetopt 
  4. #
  5. # GNU gengetopt is free software; you can redistribute it and/or modify 
  6. # it under the terms of the GNU General Public License as published by 
  7. # the Free Software Foundation; either version 2, or (at your option) 
  8. # any later version. 
  9. #
  10. # GNU gengetopt is distributed in the hope that it will be useful, but 
  11. # WITHOUT ANY WARRANTY; without even the implied warranty of 
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  13. # Public License for more details. 
  14. #
  15. # You should have received a copy of the GNU General Public License along 
  16. # with gengetopt; see the file COPYING. If not, write to the Free Software 
  17. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
  18.  
  19. PROGNAME = $(top_builddir)/src/gengetopt$(EXEEXT)
  20. MAKE_SAMPLES = $(MAKE) $(AM_MAKEFLAGS) $(EXTRA_PROGRAMS)
  21. SAMPLES_STAMP = samples.stamp
  22. GGO_FILES = $(srcdir)/sample1.ggo $(srcdir)/sample2.ggo 
  23.  
  24. # we don't have to link to anything
  25. LIBS =
  26.  
  27. # check if we need to link with getopt.o and strdup.o
  28. if NO_GETOPTLONG
  29. GETOPTLONG_O = $(top_builddir)/src/getopt.o $(top_builddir)/src/getopt1.o
  30. else
  31. GETOPTLONG_O =
  32. endif
  33.  
  34. if NO_STRDUP
  35. STRDUP_O = $(top_builddir)/src/strdup.o
  36. else
  37. STRDUP_O =
  38. endif
  39.  
  40. # if cpp2html is not installed we simply ignore the changes
  41. # FIXME: maybe we have to notify the developer about it
  42. if NO_CPP2HTML
  43. cmdline1.c.html: cmdline1.c
  44.     touch $@
  45. else
  46. cmdline1.c.html: cmdline1.c
  47.     $(CPP2HTML) -i $< --doc
  48. endif
  49.  
  50. # man page
  51. man_MANS = gengetopt.1
  52.  
  53. EXTRA_PROGRAMS = sample1 sample2
  54. sample1_SOURCES = cmdline1.c main1.cc
  55. sample2_SOURCES = cmdline2.c main2.c
  56.  
  57. LDADD = $(GETOPTLONG_O) $(STRDUP_O)
  58.  
  59. INCLUDES = -I@top_srcdir@/src/
  60.  
  61. gengetoptdoc_DATA = gengetopt.html \
  62.                     cmdline1.c.html \
  63.                     man_getopt.html no_getopt_long.txt old_changes.html
  64.  
  65. gengetoptexamples_DATA = sample1.ggo sample2.ggo main1.cc main2.c \
  66.                          cmdline1.c cmdline1.h cmdline2.c cmdline2.h
  67.  
  68. # info_TEXINFOS = gengetopt.texi
  69.  
  70. EXTRA_DIST = sample1.ggo sample2.ggo samples.stamp \
  71.              cmdline1.c cmdline1.h cmdline2.c cmdline2.h cmdline1.c.html \
  72.              $(man_MANS).in $(gengetoptdoc_DATA) cxxconfig.h \
  73.              testdata
  74.  
  75. cmdline1.c: sample1.ggo
  76.     $(PROGNAME) -i$< -Fcmdline1 --long-help -u
  77.  
  78. cmdline2.c: sample2.ggo
  79.     $(PROGNAME) --input=$< --func-name=my_cmdline_parser --file-name=cmdline2 --unamed-opts --no-handle-help --no-handle-version
  80.  
  81. cmdline1.o: cmdline1.c
  82.     $(CC) $(INCLUDES) -c $<
  83.  
  84. cmdline2.o: cmdline2.c
  85.     $(CC) $(INCLUDES) -DPACKAGE=\"sample2\" -DVERSION=\"2.0\" -c $<
  86.  
  87. # session for tests
  88. RUN_SAMPLE1 = ./sample1$(EXEEXT) -i 10 --flag-opt cmdline?.c
  89. RUN_SAMPLE1_1 = ./sample1$(EXEEXT) --help --int-opt -34
  90. # the next one generates an error 'cause -i option is not given
  91. RUN_SAMPLE1_2 = ./sample1$(EXEEXT) -F
  92. RUN_SAMPLE2 = ./sample2$(EXEEXT) -i 10 -l 20
  93. RUN_SAMPLE2_1 = ./sample2$(EXEEXT) --version
  94. RUN_SAMPLE2_2 = ./sample2$(EXEEXT) --help
  95.  
  96. check: testdata
  97.     rm -f test.out
  98.     touch $(GGO_FILES)
  99.     $(MAKE) $(AM_MAKEFLAGS) sample1$(EXEEXT) sample2$(EXEEXT)
  100.     $(RUN_SAMPLE1) >> test.out && \
  101.     $(RUN_SAMPLE1_1) >> test.out && \
  102.     $(RUN_SAMPLE2) >> test.out || \
  103.     $(RUN_SAMPLE1_2) 2>> test.out
  104.     $(RUN_SAMPLE2_1) >> test.out 
  105.     $(RUN_SAMPLE2_2) >> test.out 
  106.     @echo expect no output from diff
  107.     diff $(srcdir)/testdata test.out
  108.  
  109. testdata:
  110.     rm -f testdata
  111.     $(RUN_SAMPLE1) >> testdata
  112.     $(RUN_SAMPLE1_1) >> testdata
  113.     $(RUN_SAMPLE2) >> testdata || \
  114.     $(RUN_SAMPLE1_2) 2>> testdata
  115.     $(RUN_SAMPLE2_1) >> testdata
  116.     $(RUN_SAMPLE2_2) >> testdata
  117.  
  118. # this is to build samples once gengetopt has changed
  119. # this is for development only.
  120. samples: $(SAMPLES_STAMP)
  121.     $(MAKE) $(AM_MAKEFLAGS) $(EXTRA_PROGRAMS)
  122. #    echo timestamp > $(SAMPLES_STAMP)
  123.  
  124. $(SAMPLES_STAMP): $(PROGNAME)
  125.     touch $(GGO_FILES)
  126.     echo timestamp > $(SAMPLES_STAMP)
  127.  
  128. CLEANFILES = $(EXTRA_PROGRAMS)
  129. MAINTAINERCLEANFILES = cmdline1.c cmdline2.c cmdline1.h cmdline2.h \
  130.                        $(SAMPLES_STAMP)
  131.